using System;
using System.Collections.Generic;
using System.Text;
using SQLGen;
using Microsoft.FSharp.Core;

namespace SQLGenerationTest
{
    class TestUpdate
    {
        /*
         * To build out:
	    	* Update string * (string * string) array * Where
         */

        public static bool PerformTest()
        {
            string sql = "";
            RunTest[] tests = { SimpleUpdate };
            foreach (RunTest test in tests)
            {
                sql = test();
                Console.WriteLine(sql + "\n");
                Log.Write(sql + "\n");
            }

            return true;
        }

        static string SimpleUpdate()
        {
            Statement stmt = Statement.SimpleUpdate(
                Table.Name("mytable"),
                new Tuple<string, string>[] { new Tuple<string, string>("foo", "'xyzzy'") },
                Where.Fld("Bar").EQ(Val.IntLiteral(3)).Or(Where.All));

            return SqlModel.emitStatementSql(stmt);
        }
    }
}
